Implementation of "A Motion Detection Algorithm Using Local Phase Information" Developed by: Hector Cho

In [16]:
# import packages
import os
import numpy as np
import skvideo.io as io
import json
import matplotlib.pyplot as plt
In [23]:
# create absolute path to video
video_path = os.path.abspath("video/traffic.avi")
In [24]:
# create video generator via vreader
vidgen = io.vreader(video_path)
In [25]:
for frame in vidgen:
    plt.imshow(frame)
    plt.show()
In [10]:
metadata = io.ffprobe(video_path)
print(metadata.keys())
print(json.dumps(metadata["video"], indent=4))
dict_keys(['video'])
{
    "@index": "0",
    "@codec_name": "msmpeg4v2",
    "@codec_long_name": "MPEG-4 part 2 Microsoft variant version 2",
    "@codec_type": "video",
    "@codec_time_base": "1/15",
    "@codec_tag_string": "MP42",
    "@codec_tag": "0x3234504d",
    "@width": "160",
    "@height": "120",
    "@coded_width": "160",
    "@coded_height": "120",
    "@has_b_frames": "0",
    "@pix_fmt": "yuv420p",
    "@level": "-99",
    "@refs": "1",
    "@r_frame_rate": "15/1",
    "@avg_frame_rate": "15/1",
    "@time_base": "1/15",
    "@start_pts": "0",
    "@start_time": "0.000000",
    "@duration_ts": "120",
    "@duration": "8.000000",
    "@nb_frames": "120",
    "disposition": {
        "@default": "0",
        "@dub": "0",
        "@original": "0",
        "@comment": "0",
        "@lyrics": "0",
        "@karaoke": "0",
        "@forced": "0",
        "@hearing_impaired": "0",
        "@visual_impaired": "0",
        "@clean_effects": "0",
        "@attached_pic": "0",
        "@timed_thumbnails": "0"
    }
}